package logic.SysDepartment

import cn.ibizlab.util.domain.EntityBase
import cn.ibizlab.util.helper.RuleUtils
import cn.ibizlab.util.security.AuthenticationUser
import cn.ibizlab.util.security.SpringContextHolder
import cn.ibizlab.core.ad.domain.SysDepartment
import cn.ibizlab.core.ad.service.SysDepartmentService
import cn.ibizlab.core.ad.domain.SysOrganizationalRole
import cn.ibizlab.core.ad.service.SysOrganizationalRoleService
import cn.ibizlab.core.ad.domain.SysOrganizationalRole
import cn.ibizlab.core.ad.service.SysOrganizationalRoleService
import com.alibaba.fastjson.JSONObject
import org.springframework.util.ObjectUtils

/**
 *  新建前加载默认组
 */
class DefaultGroup {

    //当前用户
    def curuser = AuthenticationUser.getAuthenticationUser()
    //传入变量
    def _default
    //item
    def _item = new SysOrganizationalRole()
    //list
    def _list = new SysOrganizationalRole()
    //返回参数
    def _return

    def execute(arg) {
        println 'running....'
        _default = arg
        
        
        _return = arg
        begin()
        println 'running end....'
        return _return
    }

    //开始
    def begin() {
    
        //连接名称
        if(true) {
            prepareparam1()
        }
    }

    //初始化默认组
    def prepareparam1() {
        _item.set("name", "默认组")
        _item.set("sort", "100")
        _list.set("", _item.get(""))

        if(true) {
            prepareparam2()
        }
    }

    //准备参数
    def prepareparam2() {
        _default.set("groups", _list.get(""))

        if(true) {
            end1()
        }
    }

    //结束
    def end1() {
        _return = _default

    }

}
